//
//  FMDiantaiPlayView.m
//  PsychologyFM
//
//  Created by lanou on 16/1/13.
//  Copyright © 2016年 ZhangLuDu. All rights reserved.
//

#import "FMDiantaiPlayView.h"


@implementation FMDiantaiPlayView

- (instancetype)initWithFrame:(CGRect)frame
{
    
    self = [super initWithFrame:frame];
    if (self) {
        //  添加视图
        _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
        _scrollView.contentSize = CGSizeMake(kScreenWidth, kScreenHeight + 20 );
        [self addSubview:_scrollView];
        
        _coverImgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenWidth)];
        [_scrollView addSubview:_coverImgView];
        
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, _coverImgView.bottom - 50, kScreenWidth * 2 / 3 - 15, 30)];
        _titleLabel.textColor = FMWhite;
        _titleLabel.text = @"如何找到好工作";
        _titleLabel.font = [UIFont systemFontOfSize:20];
        [_scrollView addSubview:_titleLabel];
        
        _viewnumLabel = [[UILabel alloc]initWithFrame:CGRectMake(_titleLabel.right, _coverImgView.bottom - 40, kScreenWidth / 3 - 15, 20)];
        _viewnumLabel.textColor = FMWhite;
        _viewnumLabel.text = @"收听111111";
        _viewnumLabel.textAlignment = NSTextAlignmentRight;
        _viewnumLabel.font = [UIFont systemFontOfSize:14];
        [_scrollView addSubview:_viewnumLabel];
        
        _preButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _preButton.frame = CGRectMake(kScreenWidth / 2 - 105, _coverImgView.bottom + 10, 60, 60);
        [_preButton setImage:[UIImage imageNamed:@"pre"] forState:(UIControlStateNormal)];
        [_scrollView addSubview:_preButton];
        
        _playButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _playButton.frame = CGRectMake(kScreenWidth / 2 - 40, _coverImgView.bottom, 80, 80);
//        [_playButton setImage:[UIImage imageNamed:@"play"] forState:(UIControlStateNormal)];
//        [_playButton setImage:[UIImage imageNamed:@"pause"] forState:(UIControlStateSelected)];
        [_scrollView addSubview:_playButton];
        
        _nextButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _nextButton.frame = CGRectMake(kScreenWidth / 2 + 105 - 60, _coverImgView.bottom + 10, 60, 60);
        [_nextButton setImage:[UIImage imageNamed:@"next"] forState:(UIControlStateNormal)];
        [_scrollView addSubview:_nextButton];
        
        _durationLabel = [[UILabel alloc]initWithFrame:CGRectMake(kScreenWidth - 70, _coverImgView.bottom + 30, 55, 20)];
        _durationLabel.text = @"-26:25";
        _durationLabel.textColor = FMGray;
        _durationLabel.textAlignment = NSTextAlignmentRight;
        _durationLabel.font = [UIFont systemFontOfSize:13];
        
        [_scrollView addSubview:_durationLabel];
        
        _fmSlider = [[UISlider alloc]initWithFrame:CGRectMake(0, _playButton.bottom + 10, kScreenWidth, 5)];
        _fmSlider.thumbTintColor = FMOrange;
        
        [_scrollView addSubview:_fmSlider];
        
        _speakIconButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _speakIconButton.frame = CGRectMake(15, _fmSlider.bottom + 20, 80, 80);
        _speakIconButton.layer.cornerRadius = 40;
        _speakIconButton.layer.masksToBounds = YES;
        [_scrollView addSubview:_speakIconButton];
        
        _speakNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(_speakIconButton.right + 10, _speakIconButton.top + 5, 150, 30)];
        _speakNameLabel.textColor = FMBlack;
        _speakNameLabel.text = @"心理FM";
        _speakNameLabel.font = [UIFont systemFontOfSize:20];
        [_scrollView addSubview:_speakNameLabel];
        
        _speakContentLabel = [[UILabel alloc]initWithFrame:CGRectMake(_speakIconButton.right + 10, _speakNameLabel.bottom, kScreenWidth - 15 - 15 - 80 - 10, 70)];
        _speakContentLabel.textColor = FMGray;
        _speakContentLabel.numberOfLines = -1;
//        _speakContentLabel.text = @"心理FM心理FM心理FM心理FM心理FM心理FM心理FM心理FM心理FM心理FM心理FM心理FM心理FM心理FM心理FM";
        _speakContentLabel.font = [UIFont systemFontOfSize:13];
        [_scrollView addSubview:_speakContentLabel];
        
        _backButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _backButton.frame = CGRectMake(20, 20, 40, 40);
        [_backButton setImage:[UIImage imageNamed:@"whiteback"] forState:(UIControlStateNormal)];
        [self addSubview:_backButton];
        
        
        
        
//        //  颜色
//        _coverImgView.backgroundColor = FMGray;
//        _titleLabel.backgroundColor = FMGreen;
//        _viewnumLabel.backgroundColor = FMBlack;
//        _nextButton.backgroundColor = FMRed;
//        _playButton.backgroundColor = FMRed;
//        _preButton.backgroundColor = FMRed;
//        _durationLabel.backgroundColor = FMRed;
//        _speakCoverImgView.backgroundColor = FMRed;
//        _speakNameLabel.backgroundColor = FMGreen;
//        _speakContentLabel.backgroundColor = FMRed;
        
        
    }
    
    
    
    
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
